class Solution {
public:
    bool IsPopOrder(vector<int>& pushV, vector<int>& popV) {
        // write code here
         int j = 0;
         stack<int> st;
    for (int i = 0;i < pushV.size();i++)
    {
     st.push(pushV[i]);
     while (st.size() && st.top() == popV[j])
     {
         st.pop();
         j++;
     }
    }
    if(st.size()) return false;
    else return true;
    }
};